package cn.hnu.qq.client.panel;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

/**
 * tabPanel上小组件
 * @author jared
 *
 */
public class SystemPanel extends JPanel {

	private JButton btnNewButton;
	private String  title;
	/**
	 * Create the panel.
	 */
	public SystemPanel(String title) {
		setLayout(null);
		this.title = title;
		JLabel lblNewLabel = new JLabel(title);
		lblNewLabel.setBounds(10, 10, 54, 15);
		add(lblNewLabel);
		
		btnNewButton = new JButton("X");
		btnNewButton.setBounds(72, 6, 39, 19);
		add(btnNewButton);
		this.setSize(115, 32);
	}
	@Override
	protected void paintComponent(Graphics g) {
		Image image = null;
		try {
			image = ImageIO.read(new File("src/main/java/image/08.jpg"));
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		};
				
		g.drawImage(image, 0, 0, this.getWidth(), this.getHeight(), this);

	}
	public void addActionListener(ActionListener l){
		btnNewButton.addActionListener(l);
	}
	
	public String getTitle(){
		return this.title;
	}
}
